﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using BrokerBase.Lib.Policy;
using BrokerBase.Lib.Product;

namespace broker.duty.XHRS
{
    class Class5
    {
        public void Calc1(IPolicyPeriodActing ppa, IDutyActing da)
        {
            if (ppa.Period > 0)
            {
                double f = (double)ppa.SchemePeriodActing.SchemeActing.GetAuxConfigValue("分红率(预估)");

                ppa.Amount += ppa.PolicyActing.PeriodActings[ppa.Period - 1].Amount * f;
            }

            IInsurancePeriod ip = ppa.PolicyActing.Policy.SelectedInsurancePeriod;

            if (ip != null)
            {
                if (ip.Style == InsurancePeriodStyle.Age)
                {
                    if (ppa.Age == ip.Value)
                    {
                        da.Value = ppa.Amount;
                        ppa.IsCurrentFinish = true;
                    }
                }
                else if (ip.Style == InsurancePeriodStyle.Period)
                {
                    if (ppa.Period == ip.Value)
                    {
                        da.Value = ppa.Amount;
                        ppa.IsCurrentFinish = true;
                    }
                }
            }

        }

        public void Calc1(IPolicyPeriodActing ppa, IDutyActing da)
        {
            if (ppa.SchemePeriodActing.InsurantStates.Contains("住院"))
            {
                int fee = Convert.ToInt32(ppa.SchemePeriodActing.SchemeActing.GetAuxConfigValue("手术及杂费金额"));

                if (fee > 500)
                {
                    da.Value = fee > ppa.Amount ? ppa.Amount : fee;
                }
            }

        }
    }
}
